## Process this file with automake to produce Makefile.in

SUBDIRS = lib objects plug-ins shapes app bindings samples po sheets data doc tests

gnomedatadir = $(datadir)

#desktop_in_in_files = dia.desktop.in.in
#desktop_files = $(desktop_in_files:.desktop.in.in=.desktop)

applicationsdir = $(datadir)/applications
applications_DATA = $(desktop_files)

CLEANFILES = core-translation-report dia.keys dia.desktop 

#DISTCLEANFILES = $(desktop_files)

#--- Adapted from http://svn.xfce.org/svn/xfce/libexo/trunk/exo-helper/helpers/Makefile.am

desktopdir = $(datadir)/applications
desktop_in_files = dia.desktop.in
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)

DISTCLEANFILES =							\
	$(desktop_DATA) $(desktop_in_files)

#---
dia.desktop.in: $(top_srcdir)/dia.desktop.in.in $(wildcard $(top_srcdir)/po/*.po)
	$(INTLTOOL_MERGE) $(top_srcdir)/po $< $(@) -d -u -c $(top_srcdir)/po/.intltool-merge-cachemake

# I'd love to have automake do this substitution for me, but then it'd happen
# before intltool above, and that one doesn't understand builddir and so can't
# use the output.
dia.desktop: dia.desktop.in
	sed -e 's/@VERSION/@'$(VERSION)'/;' < $< > $@

distclean-local:
	rm -f dia.keys
	rm -f intltool-extract
	rm -f intltool-merge
	rm -f intltool-update

mimedir = $(gnomedatadir)/mime-info
mime_DATA = dia.mime dia.keys

po/dia.pot: 
	(cd po ; $(MAKE) dia.pot)

po/Makefile: po/Makefile.in
	(cd po ; make -f Makefile.in Makefile ; make) # gettext hack

core-translation-report: po/dia.pot $(srcdir)/po-checktrans.py $(srcdir)/po-checktrans
	if [ ! "$(srcdir)" -ef "." ]; then    \
	  cp $(srcdir)/po-checktrans .;    \
	  cp $(srcdir)/po-checktrans.py .; \
	fi
	./po-checktrans po/dia.pot $(srcdir)/po/*.po
	if [ ! "$(srcdir)" -ef "." ]; then    \
	  rm -f ./po-checktrans ./po-checktrans.py; \
	fi

all-local: core-translation-report po/Makefile


tests:
	cd tests && $(MAKE) tests

# on uninstall scrollkeeper will leave behind an empty database
# See http://mail.gnome.org/archives/desktop-devel-list/2003-July/msg00144.html
# Requires automake-1.7, so 'export WANT_AUTOMAKE=1.7' before './autogen.sh'
distuninstallcheck_listfiles = find . -type f -print | grep -v '^\./var/scrollkeeper'

#distuninstallcheck:
#	@:

EXTRA_DIST = dia.desktop.in.in KNOWN_BUGS $(pkgdata_DATA) \
	dia.mime dia.keys.in po-checktrans.py po-checktrans \
	intltool-extract.in intltool-merge.in intltool-update.in \
	RELEASE-PROCESS autogen.sh makefile.msc \
	config.h.win32 readme.win32 AUTHORS MAINTAINERS THANKS

if MAINTAINER_MODE
THANKS: all-recursive
	app/run_dia.sh --credits > THANKS
endif
